package com.rslai.base.tool.servertest.config;

import com.rslai.base.tool.servertest.annotation.Element;
import com.rslai.base.tool.servertest.annotation.Property;
import com.rslai.base.tool.servertest.command.CallStepCommand;
import com.rslai.base.tool.servertest.command.StepCommand;
import com.rslai.base.tool.servertest.model.KeyValueStore;
import com.rslai.base.tool.servertest.transport.command.ExecuteCommand;
import com.rslai.base.tool.servertest.transport.command.ServiceFactory;

import java.util.List;

public class CallStepConfig extends StepConfig {

    @Property(required = true)
    String service;

    @Element
    List<KeyValueStore> params;

    public StepCommand createCommand() {
        ExecuteCommand command = ServiceFactory.getInstance().getCommand(this.service);
        return new CallStepCommand(command, this.params);
    }
}
